<?php

require_once("config_inc.php");

require_once("core/user_api.php");
require_once("core/share_api.php");

session_start();

if(!is_active_user_session())  
{ 
	exit(); 
}

if(isset($_POST["request"]) && $_POST["request"] == "toggle_project_likeit")
{	
	$db = new database();
	$db->connect();
	
	$share_api = new share_api($db);
	$share_api->toggle_project_likteit($_POST["project_id"], $_SESSION["user_id"]);
	
	$likeit_count = $share_api->get_count_likeit($_POST["project_id"]);
	
	$db->close();
	
	echo (json_encode(array("likeit_count" => $likeit_count)));	
}
	
?>